Object oriented system for managing complex financial instruments

ABSTRACT

Object oriented design strategies and patterns are applied to financial data processing systems for processing and modeling of financial products (also referred to as financial instruments) with an emphasis being on derivative products. The system employs valuation independent, well-defined financial components (also referred to as financial events) that can be combined to build new financial structures. A general purpose software model is provided for representing the structure and characteristics of these products. A declarative specification language is provided to describe financial instruments in a consistent manner that lends itself to processing in such an object oriented system. A general traversal process is provided that can be applied to the macro structure of a financial instrument to implement various functions that produce results based on such information, such as the stream of financial events associated with the instrument, or the pricing or valuation of the instrument.

CROSS-REFERENCE TO RELATED APPLICATIONS

This patent application is a continuation of U.S. patent applicationSer. No. 12/638,195, filed on Dec. 15, 2009, now U.S. Pat. No.8,099,347, which is a continuation of U.S. patent application Ser. No.09/127,341, filed on Jul. 31, 1998, now U.S. Pat. No. 7,801,782, both ofwhich are hereby incorporated in their entirety.

BACKGROUND OF THE INVENTION

1. Field of the Invention

This invention generally relates to the field of systems for dataprocessing in the financial services industry, and more particularly tosystems for managing substantial portfolios of derivatives and othercomplex financial instruments now widely used in that industry.

2. Description of the Related Art

There are several major domains of interest in the design andimplementation of modern risk management systems. These include:

-   -   modeling of valuation methodologies    -   modeling of financial products    -   modeling of market environment information    -   frameworks for risk analysis    -   frameworks for persistence

Much thought and effort has been put into the study of valuation/pricingmodels for the financial services industry. These studies are often of ahighly theoretical and academic nature. While the continued developmentof pricing models is absolutely essential for the evolution of thefinancial business it does not supply the entire solution.

As a result of our experience in this field, we have concluded that thefinancial services industry cannot just concentrate on the valuationmodels alone. In practice, a typical financial institution at any timewill have positions in significant numbers of financial instruments, theterms of which may vary significantly from one another, even within asingle series of instruments. Separate and apart from the science ofpricing and valuing individual instruments, is the practical problem ofmanaging such a number of dissimilar instruments in a consistent manner.Another issue is adjusting the processing of those instruments in aconsistent and coordinated way as the pricing and valuation techniquesthemselves evolve and change.

The ability of a firm's data processing systems to deal with such anumber and variety of instruments is essential in order to supportreliable and consistent financial and regulatory reporting, which is akey operating requirement for virtually all firms in this industry.Without such a system, the pricing results for similar instruments mayvary inexplicably, portfolio valuations may be unreliable, andimplementing new or modified pricing, valuation or processing techniquesmay require cumbersome instrument-by-instrument adjustments which canbecome impracticable.

In order to solve such problems, we must study generic computer sciencemethodologies that bring pragmatic systems considerations to light,which may then be applied. In addition to providing a new systemarchitecture, our solution involves a formalized approach to theimplementation of pricing and risk management systems, which we believeis also essential to the success of the financial business in this area.

BRIEF SUMMARY OF THE INVENTION

It is an object of the present invention to address the issues ofconsistency, manageability and modifiability described above by applyingobject oriented design strategies and patterns to the modeling andprocessing of financial products (also referred to as financialinstruments) with an emphasis on derivative products. It is a furtherobject of the invention to provide means to specify financialinstruments in a consistent manner that lends itself to controlled andconvenient instrument development and data entry. It is still a furtherobject of the invention to provide a general means of processingfinancial data that is directed at the macro structure of a financialinstrument but may be applied without variance for individual instrumentcharacteristics.

To accomplish these and other objectives of the invention, we havedeveloped a system that employs valuation independent, well-definedfinancial components (also referred to as financial events) that can becombined to build new financial structures. “Valuation independent”means that financial instruments are modeled independently of theirvaluation methodologies. A general purpose software model is providedand implemented in this system for representing the structure andcharacteristics of these products. A declarative specification languageis provided to describe financial instruments in a consistent mannerthat lends itself to processing in such an object oriented system. Ageneral traversal process is provided that can be applied to the macrostructure of a financial instrument to implement various functions thatproduce results based on such information, such as the stream offinancial events associated with the instrument, or the pricing orvaluation of the instrument. We also provide within this system aframework for processing the resulting structures in a way that supportsvarious valuation methodologies. Techniques including double dispatchand other mechanisms are utilized to provide flexible means ofassociating the appropriate processing methods with the diverse range ofinstrument characteristics that are encountered in a typical financialinstitution's course of business. Such techniques allow developers toquickly and easily incorporate new valuation methodologies into thesystem as these methodologies become available.

We will describe the basic concepts of these models in a way that is asimplementation independent as possible; hence this specification willcontain pseudo-code only when necessary to illustrate the concepts inquestion.

This design has been implemented in Smalltalk and Java and we believe itcan be implemented in any other object oriented language. Of course,since each development environment has its own tradeoffs, theimplementation of such a complex system in a new development environmentwill present challenges, but ones we believe to be within the competenceof persons reasonably skilled in the art.

The manner in which the foregoing objectives are attained is furthershown by the drawings enumerated below, and the accompanying detaileddescription. It should be apparent therefrom that although the inventionhas been illustrated with a particular preferred embodiment (and certainvariations thereon), its principles could equally well be implemented inother ways without departing from the scope and spirit of the invention.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a block diagram showing the component design approachimplemented in the present invention.

FIG. 2 is a diagram showing the micro structure of a financialinstrument implemented in accordance with the invention.

FIG. 3 is a block diagram showing an example of the macro structure of afinancial instrument.

FIG. 4 is a block diagram showing as an example the structure of asimple equity option.

FIG. 5 is a block diagram showing the relationship between the parameterrepresentation of a financial instrument and its event streamrepresentation as generated by an event extraction transformation.

FIG. 6 is a block diagram showing the use of alternative instrumentparameter instantiation for purposes of relational or object orientedpersistent storage.

FIG. 7 is a block diagram showing an overall view of the structure andprocessing of the present invention, including the static and eventrepresentation of financial instruments; the event extractiontransformation process that generates the event representation from thestatic representation, and the stream processing objects that act uponthe event representation to provide the desired business results anddata.

FIG. 8 is a block diagram illustrating the event stream associated witha simple swap instrument.

FIG. 9 is a block diagram illustrating the event stream associated witha simple option instrument.

FIG. 10 is a block diagram showing an example of a class hierarchy thatmight be used to implement processing objects.

FIG. 11 is a diagram showing certain methods implemented on event andprocessing classes.

FIG. 12 is a block diagram illustrating a sequence of events involved ina double dispatch mechanism.

FIG. 13 is a block diagram illustrating a sequence of events involved ina nested double dispatch mechanism.

FIG. 14 is a block diagram illustrating a swap payment eventcorresponding to the instrument that was the subject of FIG. 8.

DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENT

The preferred embodiment of the invention is illustrated in FIGS. 1-14and Listings 1-16 below and described in the text that follows. Thereader should bear in mind, however, that the details of this embodiment(and of the variations thereon that are presented) are not intended tolimit the scope of the invention.

It should be noted that all of the systems described in thisspecification involve the processing of financial data by meansincluding one or more general purpose digital computers and relatedstorage devices, networks, peripherals, systems and developmentsoftware. Such processing is accomplished by programming such computersin accordance with the methods and techniques set forth herein.

1. THE MAIN CONCEPTS

1.1. Independent Financial Product Modeling

As stated earlier, the essential concept that underlies all of our workin this area is that financial products can and should be modeledindependently of their valuation methodologies. We wish to avoid thesituation where the software model of a product is dictated by itsvaluation methodology.

Valuation techniques are in constant flux, evolving and changing at arapid pace. For proper maintenance of any complex financial system, itis crucial that the product models not be modified when new pricingalgorithms arrive. Instead, one should be able to associate new pricingalgorithms with pre-existing financial products without affecting theproducts themselves.

To illustrate this point, consider a simple equity option. A value forthis financial product can theoretically be calculated in severaldifferent ways. One could use the classic Black & Scholes formula, aprobabilistic tree model or even a Monte Carlo simulation. Eachmethodology calculates the option's value in a different way and henceone would expect slightly different results. However, even though thevalues differ, the structure and characteristics of the option do notchange. It should be possible to use any of these valuation models onthe exact same representation of the equity option. To accomplish thiswe require that the product model and valuation methodologies beindependent of one another.

1.2. Financial Component Architecture

Another key concept in this model is a component based approach in whichfinancial instruments are composed of basic financial building blocks.These building blocks are referred to as financial components orfinancial events.

Here the assumption is made that new financial instruments differ mostlyin the way in which they compose and organize these building blocks andonly rarely in the building blocks themselves.

Each building block models a very well defined and specific financialconcept. Each financial component should be very simple and will:

-   -   capture the financial concept it models    -   be re-useable by all developers requiring that type of financial        concept

One can think of this as a “Lego blocks” approach in which a financialdeveloper has a toolbox of financial building blocks, called “financialevent templates” (or sometimes referred to as “financial componenttemplates”) that can be utilized to make whatever financial structuresare necessary.

1.2.1. Financial Component Micro Structure

As seen in FIG. 1, the toolbox consists of financial componenttemplates, 101, 102, etc. Each financial component can have internalinstance variables that point to either simple state information (e.g.numbers and dates) or other components. This means that components canbe easily nested to whatever level necessary.

It is important to point out the subtle difference in terminology herebetween financial events and financial event templates. Templates areused in descriptions as place holders for real events. As will bedescribed later, these descriptions are used to generate real eventsfrom the templates.

Each component may have internal variables that point to othercomponents. For each variable that can point to another component aninterface must be specified. Any component pointed to by that variablemust support the defined interface. The interface must also be“processor independent”. This means that it returns results that willnot change depending on the kind of processing taking place.

The association of an interface for all internal variables that cancontain other components defines the “micro structure” of a component.This is illustrated by the example of a micro structure for a paymentcomponent shown in FIG. 2. Note that the processing interface shown inthis figure is required of all basic components.

1.2.2. Financial Instrument Macro Structure

Given a set of basic financial components, the next step is to provide amechanism for specifying how different components fit together to formthe model for financial instruments. This is represented in FIG. 1 asthe “Instrument Specifications” section 110.

The financial instrument specification describes which kind ofcomponents an instrument will contain and how they will relate to eachother. This is the “macro structure” of a financial instrument. Anexample of a macro structure is shown in FIG. 3.

The important part of the macro structure is how components are relatedor nested within each other. The macro structure also defines whichactual nested components are used within the confines of the microstructure for each component.

1.3. Standard Mechanism for Defining an Instrument Specification

At this level of detail, the instrument specification is a very genericconcept. It simply means that a standardized mechanism has been definedto specify how financial building blocks are to be composed to representa given financial instrument. This can also be thought of as thedescription of the macro structure of the instrument.

There are varying ways to implement this concept and this point will bediscussed later. Regardless of the implementation, the critical elementfor this concept to work is that all developers use the same mechanismto define these instrument specifications. This allows any developer toeasily read and understand an instrument defined by a fellow developer.This also creates an environment in which financial instrumentdevelopers can communicate, interact and share complex ideas with ease.

1.4. Formalized Financial Instrument Structure

In this model the software structure of any financial instrument isfactored into distinct portions. This factoring is done based onunderlying financial considerations. Essentially, each product iscomposed of the following pieces:

-   -   instrument parameters-a set of state information    -   instrument specification-a description of the structure of the        financial events    -   instrument event stream—the financial events resulting from the        parameters and specification

A financial instrument's object structure is illustrated in FIG. 4. Theinstrument instance holds onto an instance of each piece of itsstructure. It is important to recognize that every instrument,regardless of its type or specific details, has this structure. It isthe specialization of the internal instances that differentiates oneinstrument from another.

This factoring allows for a well defined dependency between thedifferent portions of the instrument. We can represent this dependencyas follows:instrument parameters⊕instrument specification=instrument event stream

The ⊕ operation is obviously not a simple addition operation. It isactually a generic transformation process called event extraction. Eventextraction is generic because the exact same process is used for allfinancial instruments. To generate the events for a new type ofinstrument one simply has to define the specification and parameters andpass them to the event extraction process. This process always createsexactly the same events for a given combination of instrumentspecification and instrument parameters. This process has many moreramifications which will be discussed in detail in later sections.

This factoring also allows developers to inherit state and functionalityindependently for each piece of an instrument.

1.5. Instrument and Event Processing

As stated earlier, processing is independent from the framework fordefining financial instruments. The term “processing” is used to coverany and all operations that can be applied to a financial instrument andits events.

The intention of this model is that all processing functionalityinterfaces with the financial instruments in a well defined andstructured way such that its separation from the instrument definitionmodels remains intact.

2. FINANCIAL INSTRUMENT INTERNAL STRUCTURE

As described above, there is a well defined, standard structure for allfinancial instruments as well as a generic transformation process calledevent extraction. These pieces of the instrument's structure and theirrelationships are illustrated in FIG. 5.

On the left side of FIG. 5 one can see the “static representation” 501of the instrument. This representation excludes the laid out eventstreams. On the right side of FIG. 5 one can see some examples offinancial event streams 502, 503, etc. that could have been created viathe event extraction process, forming a timeline of interrelated eventobjects that is specific to the given static representation. This is thecanonical “event representation” of the instrument.

Since, by definition, the event representation of a financial instrumentcan always be generated from its static representation, it is notnecessary to make the event representation persistent. This allows theimplementation to support various persistence models.

2.1. Instrument Parameters

The instrument parameters provide a data storage service, i.e.—a stateserver, for the particular instrument instance. One can considerinstrument parameters as a bag of data which is filled, e.g. like in aspreadsheet. Later this bag of data is associated with a particularinstrument. This supports a much more incremental association of datawith financial instruments and could be useful in certain workprocesses.

There is a fixed interface for accessing and setting these parameters.As long as this interface is adhered to, parameter objects can beimplemented in arbitrary ways and multiple implementations can coexistin harmony. The benefit of this flexibility is shown in the followingexample.

Example Transparent Database Storage Mechanism

Consider the case in which a system is designed to integrate both a highvolume “vanilla” financial business as well as a low volume, structured,“exotic” financial business. In most cases, a relational databasetechnology is chosen for the vanilla business because it ischaracterized by relatively well defined and stable instrumentstructures. The exotic financial business, on the other hand, ischaracterized by the rapid development of highly complex instrumentstructures, therefore object oriented databases can be better suited. Itis typically true that an exotics business uses associated vanillafinancial products for hedging purposes. Therefore we would like to beable to store the vanilla products in either database technology.

This problem can be easily solved with the instrument parameterparadigm. Essentially, there would be two hierarchies of instrumentparameter objects; one that could be made persistent in a relationaldatabase and one that could be made persistent in an object orienteddatabase. There would be a subclass in each hierarchy specifically forthe given vanilla product. Both classes would support the same interfaceand would also support the same number and names of variables.Therefore, it would be transparent to the rest of the system, and to thefinancial instrument itself, what kind of database technology was beingused. The actual kind of class needed would be determined by theunderlying database requirements. It is also possible to switch, “on thefly”, between database technologies as the different instances ofparameter objects are essentially equivalent. This is illustrated inFIG. 6.

Another important advantage of this mechanism is that the classhierarchy of parameters is independent of the class hierarchy of all theother portions of the instrument. This separates the type of instrumentfrom the state and behavior of the object that represents theparameters.

2.2. Financial Components

Financial components model simple, very narrow portions of real financebusiness concepts. These components must be reusable and verystraightforward to understand and manipulate. When new financialinstrument specifications are defined, developers must use pre-existingfinancial components unless they require a business concept that is notyet implemented. This achieves the composition strategy stated earlierbecause each business concept will be modeled by one, and only one,software object.

Using one software object to model a business concept allows for a veryflexible system environment. Developers can expect the same object, andtherefore the same behavior and state information, for a given businessobject in any financial instrument. Therefore, adding new types ofinstrument processing functionality can be accomplished quitegenerically. This concept will be detailed in Section 3 (“GenericProcessing Framework”) below.

If a development team adheres to this model one can expect the number offinancial components for a given financial business environment to leveloff quickly. Essentially, the total number of business concepts isexhausted quite rapidly and therefore there is no need to develop morefinancial components. (For example, we found that about 45 basiccomponents are sufficient to model all fixed income derivativeinstruments at JP Morgan.) Of course, this does not mean that the numberof possible financial instruments is limited in any way. Since theinstruments are built from organizations of different combinations ofthe components, the permutations are, in effect, limitless. Thisorganization is formalized via the instrument specification which willbe detailed in the Section 2.3 (“Instrument Specification”) below.

In general, the most basic business concepts become the base componentclass for all further specialization. These base classes typicallyidentify and formalize the framework and interface for each businessconcept. This results in a component object hierarchy that is neatly andclearly divided along business lines. It allows developers to stronglyleverage the inheritance tools available in all object orientedenvironments. The following example illustrates this strategy.

Example Cash Flow Components

A financial component that is appropriate for just about every kind offinancial business is the payment or cashflow event. The cashflow eventmodels the movement of a certain amount of a given currency, in or outon a given date. It must nominally have the following state information:

-   -   currency—what type of cash is involved    -   notional—amount of currency changing hands    -   payment date—the date on which the transfer occurs

This event should be used in all financial instrument specificationsthat require a simple cashflow to take place. Clearly, however, thereare more specialized payment concepts in the financial world. Therefore,the simple cashflow event is also the superclass for all other kinds offinancial payments.

Now consider a payment that is based on an interest rate applied over aperiod of time. This concept is also quite basic and applicable to mostfinancial businesses. The model for this concept would be a subclass ofthe simple payment event, it would have to add the following stateinformation:

-   -   accrual period—fraction of a year over which the interest rate        applies

This interest rate payment is more specialized than the basic paymentclass but it could still be used in any event micro structure in whichthe basic payment interface were required as it supports this interface.

2.3. Instrument Specification

In general, the instrument specification defines or describes howfinancial components fit together in a logical structure thatcharacterizes a given financial instrument. One aspect of this is thedescription of the macro structure concept introduced earlier.

The specification for each financial instrument must detail:

-   -   which parameters are required    -   which financial components are to be used and what state they        would have    -   how the components are related to each other; both with respect        to time and encapsulation    -   how the parameters are related to the components

There are numerous ways in which to formalize a mechanism that allowsdevelopers to define such specifications. Three of the main strategiesare discussed below, along with their associated advantages anddisadvantages:

2.3.1. Financial Markup Language (FML)

One can consider the instrument specification concept to be a kind ofspecial purpose language, much like Hardware Definition Language (HDL)(a language used for some time by electrical engineers to define howelectrical components fit together to compose complex systems) orExtended Markup Language (XML). FML would essentially be a declarativelanguage with well defined, enforceable syntax and usage patterns.Hence, there would actually be two representations of a specification;the textual representation and the objectified representation. Thetextual representation would be easily readable by humans and theobjectified representation would be much like a language parse tree;optimized for efficient execution. The process of transforming thetextual representation to the objectified representation would behandled by a parser. We call this the specification extraction process.

This is a programming language independent approach for describingfinancial instruments. It is different from the programming language inwhich the event extraction and processing frameworks are implemented.

This approach provides the most control over the specificationdevelopment environment. Since the language syntax can be easilyenforced via the transformation process, the designer of the system hasthe ability to decide all aspects of the language. Developers cannotwander from the syntax and hence it will remain standardized and easilydecipherable by all who are familiar with it. This scheme can alsoprovide self-documenting aspects to the system that can be leveraged formany other purposes.

Another advantage to this approach is that it can provide flexiblefactoring and reuse of specifications to the developer. It can alsoclearly describe what parameters are required for a given financialinstrument specification.

A drawback to this mechanism is that it can take a significant amount ofeffort to define and develop a new language description. Secondly, thetransformation function provided by the parser also injects someprocessing overhead into the system because the system must, at somepoint, convert between the textual and objectified representations.

2.3.2. Programming Language Dependent Specifications

This approach is similar in concept to FML in that there are stilltextual and objectified representations of financial specifications andthat there is a well defined syntax. It is abbreviated in such a waythat a truly independent language is not defined. Instead, theobjectified representation of specifications are directly created withthe same programming language as the underlying system.

The specification syntax is simply a convention built on top of theregular syntax and semantics of the underlying programming language.This reuses the existing compiler or interpreter functionality totransform the textual representation of the specification into theobjectified language parse tree.

This approach makes the financial specification language dependent onthe underlying programming language and therefore limits flexibilitywhen compared with FML. However, it does require less initial investmentin terms of development time and resources and still delivers all thebenefits of having a financial specification language.

2.3.3. Algorithmic Event Generation

Instead of using a financial specification language one can generateevent streams directly using a standard programming language.

In this case, there would not be an explicit financial specification.Code would be written that, when executed, would create the events andevent streams from a set of parameters. Therefore, the code itself wouldserve as the event extraction process as well as the implicit textualdescription of the specification. The structure of the code could beinfluenced by the software framework so that it would look similar andbe readable by all developers.

This strategy has the advantage that it requires even less initialinvestment while still delivering events and event streams that can beprocessed in the generic framework described later. This strategy mayalso reduce the processing overhead associated with explicitlyconverting between the different specification representations.

A major disadvantage is the lack of control of the specificationdescription process. It is critically important that instrumentspecifications written by different developers be readable andunderstandable by all. If this is not the case, than the entire premiseof the model begins to break down. It is much more difficult, althoughnot impossible, to enforce a coding framework than a well definedlanguage syntax. This is especially true over the long term evolution ofa complex system in a high turnover environment.

This approach also limits the factoring and reuse of specifications aswell as making it difficult to determine all the required parameters fora given financial instrument.

2.3.4. Summary

We believe that all of the above schemes can be made to be successful inthe context of defining financial instruments. It is even feasible thatmultiple specification implementations can coexist in the same system(for example, to migrate a system from one form of instrumentdescription implementation to another).

However, the divergence of the specification process over the long termneeds to be considered very carefully when deciding on an approach.Therefore, we would not recommend the algorithmic approach over thespecification approaches.

A true FML implementation would definitely be the most flexible,powerful and interoperable solution. This is very much in accordancewith the current textual, domain specific data description standardsemerging in the context of XML on the Internet. (Other domain specifictextual description languages examples are: Chemical Markup Language(CML), Bioinformatic Sequence Markup Language (BSML), Open FinancialExchange (OFE), Open Trading Protocol (OTP), Synchronized MultimediaIntegration Language (SMIL).)

2.4. Instrument Event Stream

The instrument event stream represents the explicit, financial eventstructure of a given instance of a financial instrument over time. Thiscan be considered the instantiation of the macro structure of thefinancial instrument. This structure is completely defined by theinstrument specification and the instrument parameters. This isillustrated in FIG. 7.

The event stream representation maintains the full chronological list ofall the financial events for the instrument and all of the dependenciesbetween the events. It is typically this representation that providesthe information most critical to financial systems.

An important concept to note is that processing objects can only processthe instrument in its Event Stream representation. This encapsulates theprocessing domain from the instrument specification domain. A processorshould therefore be able to process an instrument's event streamregardless of the way in which it was specified.

2.5. Sample Instrument Specifications

Here we will show a sample specification for a simple interest rate swapleg instrument and an interest rate option instrument in a declarative,textual manner. The style and syntax are arbitrary and are only intendedto illustrate the specification concept. They are not intended todescribe a syntax implementation. A real implementation of a declarativespecification language would be more complex than this example.

This specification will be broken down into two main sections: theinstrument parameters declaration and the financial componentsstructure.

2.5.1. Instrument Parameters

Interest Rate Swap Leg Parameter Description

The following pseudo-code is an example of the parameters declarationsfor a simple swap:

Listing 1: Swap Leg Instrument Parameters SwapLegInstrumentParameters =(   var startDate = 1/1/96,   var endDate = 6/1/97,   varpaymentFrequency = semi-annual,   var currency = USD,   var ratelndex =3MonthLibor,   var discountOn = LiborCurve,   var dayCountConvention =30/360 )

The first four of these parameters are self explanatory. The rateindexdescribes the type of interest rate that the payment is based upon. ThediscountOn variable describes which interest rate term structure is tobe used to discount future cashflows. The dayCountConvention describeshow to count the days in the interest accrual period.

The values assigned to the parameters are default values. It is assumedthat these values can be changed to describe the differences between twoinstances of the same type of instrument.

Interest Rate Option Parameter Description

The following pseudo-code is an example of the parameters declarationsfor a simple interest rate option stream:

Listing 2: Option Instrument Parameters OptionInstrumentParametersextends SwapInstrumentParameters (   var strikeRate = 5% )

This instrument parameter declaration inherits from the swap instrumentparameters and simply adds and additional parameter, the strike ratevariable.

2.5.2. Financial Components Structure and Relationships

Interest Rate Swap Leg Specification

The following pseudo-code is an example of a specification for a singleleg of an interest rate swap:

Listing 3: Swap Leg Financial Specification  SwapLegFinancialSpecification = ( IterateDatePeriodFor (startDate,endDate, paymentFrequency) {   rate = RateTemplate (     date =period.start,     index = rateIndex)   accrual =YearFractionAccrualTemplate (     start = period.start,     end =period.end,     rate = rate,     dayCount = dayCountConvention)  payment = PaymentTemplate (     payDate = period.end + 2 days,    currency = currency,     accrualPeriod = accrualPeriod) } )

This specification has two main sections. Firstly, there is a dateperiod iterator that represents a periodic repetition of its contents;in this case based on the start, end and frequency parameters.

Within the scope of the date interval iterator three financialcomponents are defined; a rate event template, an accrual event templateand a payment event template. Looking closely we can see how thevariables for each instance are obtained from the instrument parameters,the iteration period object or an object created earlier in the process.We can tell from this declarative representation of the specificationthat each instantiated payment event would point directly to, andtherefore contain, an accrual event in its accrual period. The accrualevent would point directly to, and therefore contain, the rate event. Wealso find that the payment date is always 2 days after the end of theaccrual period.

The amount of information that we can obtain from a simple perusal ofthe specification is an example of the power of the declarative approachto specification definition. It becomes quite easy to determine thestructure of an instrument without having to instantiate it or debugcode.

Interest Rate Option Specification

The following pseudo-code is an example of a specification for a singleinterest rate option stream:

Listing 4: Option Financial Specification   OptionFinancialSpecification = ( IterateDatePeriodFor (startDate,endDate, paymentFrequency) {   rate = RateTemplate (      date =period.start,      index = rateIndex)   optionRate = OptionRateTemplate(      date = period.start,      strike = strikeRate,      rate = rate)  accrual = YearFractionAccrualTemplate (      start = period.start,     end = period.end,      rate = optionRate,      dayCount =dayCountConvention)   payment = PaymentTemplate (      payDate =period.end + 2 days,      currency = currency,      accrualPeriod =accrualPeriod) } )

This specification has a similar structure as the interest rate swap legspecification but the rate template has been replace by anOptionRateTemplate that then refers to a RateTemplate. Here thedeveloper is able to reuse the same building blocks for anotherfinancial instrument specification. For example, the sameYearFractionAccrualTemplate is used with a new type of rate templatewithout any modification. This is allowed because the micro-structure ofthe accrual event specifies an interface for the rate variable that issupported by both the OptionRateTemplate and RateTemplate objects.

2.6. Event Extraction

As described earlier, the event extraction process implements the EDtransformation in the formula below.instrument parameters⊕instrument specification(objectified)=instrumentevent stream

The event extraction process is a generic transformation that isintended to be applied to any specification that is properly formed. Itwill essentially walk (i.e.—read) the objectified specification in thecontext of the given parameters and generate the desired eventstructure.

One very important rule in the event extraction process is that theevent structure is immutable with respect to time. The same process mustalways generate exactly the same event structure given the sameparameter set and instrument specification, regardless of the relativesystem time. It is the responsibility of the processing object to ignorethe events that are not applicable based on any specified date. Thissignificantly simplifies the testing and verification of the eventextraction process. The algorithmic event generation option that wasdescribed earlier has no explicit event extraction process as the codeitself builds the events.

Interest Rate Swap Leg Event Stream

If the event extraction process were run on the sample interest rateswap leg specification with the given default parameters, the eventstructure would be as shown in FIG. 8.

During the event extraction process, the processing of the date perioditerator will create one instance of each component within its scope.This process also supplies each component with a period object thatspecifies the date interval of the current iteration. The processing ofthe iterator essentially functions as the date generation portion of thesystem.

Note here that in this instrument there is the concept of a top levelfinancial event collection, the interest payments. From a top levelinterest payment one can reach all events relevant to that payment. Thisstructural characteristic is particular to this kind of instrument andthus defined in the instrument specification.

Interest Rate Option Event Stream

If the event extraction process were run on the sample interest rateoption specification with the given default values, the event structurewould be as shown in FIG. 9.

As expected, the AccrualEvents now point to RateOptionEvents which inturn point to RateEvents. This is an outcome of the specification asdescribed above.

2.6.1. Detailed Example of Event Extraction Mechanism

In the Section 2.3 (“Instrument Specification”) we presented three waysof describing an instrument: (1) Financial Markup Language, (2)Programming Language Dependent Specifications, and (3) Algorithmic EventGeneration. Of those, a generic event extraction mechanism can only beapplied to the first two, whereas the third, by its very nature, definesthe event generation in a procedural way. The same generic mechanism canbe used for the first two if both are trans-formed into a commonintermediate representation.

The nature of this intermediate representation is an object graph ofspec objects. For each financial component template, and for all otherelements of the instrument description that hold the financial componenttemplates together, there exists a spec object. This spec object holdsthe state of the financial template. The state of a financial templateconsists of either simple data types, like integers, floats, dates,etc., or references to variables or events which would be generatedduring the generic event extraction process. Examples for suchreferences are: the last payment event, all reset events between twodates, etc. Since this is a description of the event structure, and notthe actual event structure itself, such a reference can not be stated bydirect reference, but must be stated implicitly via the events collectedduring the event extraction process.

All spec objects also implement a double dispatching protocol for theevent extraction mechanism. Beyond that double dispatching method, specobjects do not define any interesting behavior. All the knowledge on howto extract events is contained in the event extraction mechanism.

For instruments described in FML this implies that an FML parsergenerates such an object graph. Standard computer science parsingtechnologies can be applied to generate such a parse tree. Forinstruments described with a programming language dependentspecification, this implies that such a specification would generatethis object graph using programming language specific statements, inessence creating spec objects and “plugging” them together in order toform the object graph.

The intermediate spec object graph needs to be constructed only once foreach kind of instrument. It does not contain any information particularto a specific instrument. This information is provided externally, asthe instrument parameters, as explained above.

The generic event extractor that generates the “canonical” eventstructure makes use of the instrument parameterization and the specobject graph for the instrument kind. It double dispatches with the specobjects in the graph and, in that process, creates the appropriateevents, collects them, and resolves references described in theinstrument specification. Note, this is very similar to the laterprocessing of those financial events, where financial events do not knowanything about the valuation method, and all that knowledge is containedin the event processing mechanism.

In the following we discuss the objects and concepts in the intermediaterepresentation, and the generic event extraction process in detail.

2.6.2. Intermediate Representation Objects

The objects contained in the intermediate representation fall into fourcategories: structural, parameterization, references, and events.

Classes and objects in the structural category describe therelationships of objects in the large: containment, grouping and naming,as well as periodicity. Classes in this category are NamedSpec,NestedSpec, SequenceSpec, and DatePeriods.

State classes describe which aspects of a spec can be parameterized,what the parameterized data for a particular instance looks like, how torepresent temporary state, and how to represent the internal state ofspec objects. Classes in this category are TempSpec, VarSpec, DataSpec,and FieldSpec.

Reference classes describe objects that are used to form the value ofstate objects. All non-literal references form the network of internalrelationships between spec objects. Classes contained in this categoryare LiteralReference, NamedReference and Script-Reference.

Finally, event classes describe the financial components that are to becreated and extracted during the processing. The classes here areEventSpec and spec classes for all financial component classes onerequires in the model (e.g. PaymentSpec, InterestPaymentSpec, ResetSpec,AccrualSpec, Discount, etc.).

An example for an intermediate representation is presented in Listing 5.The specification from Listing 3 including a description of the requiredvariables derived from Listing 1 are shown as intermediate objects.Indenting denotes containment.

Listing 5: Swap Leg Intermediate Representation NamedSpec name =“SwapLegFinancialSpecification”  SequenceSpec   VarSpec name = startDatetype = Date   VarSpec name = endDate type = Date   VarSpec name =paymentFrequency type = DateInterval   VarSpec name = currency type =Currency   VarSpec name = rateIndex type = SmileIndex   VarSpec name =discountOn type = DiscountIndex   VarSpec name = dayCountConvention type= Basis   DatePeriodsSpec iterator = period    SequenceSpec    FieldSpec name = start value = Ref(start) type = Date     FieldSpecname = end value = Ref (end) type = Date     FieldSpec name = intervalvalue = Ref(paymentFrequency)     type = DateInterval    ResetSpecsequence = resets     FieldSpec name = date value = Ref(period.start)type = Date     FieldSpec name = index value = Ref(rateIndex) type =    SmileIndex    AccrualSpec sequence = accruals     FieldSpec name =start value = Ref(period.start) type = Date     FieldSpec name = endvalue = Ref(period.end) type = Date     FieldSpec name = rate value =Ref(resets.last) type = Event     FieldSpec name = dayCout value =Ref(dayCountConvention)     type = Basis    InterestPaymentSpec sequence= payments     FieldSpec name = payDate value = Script(period.end + 2days)     type = Date     FieldSpec name = currency value =Ref(currency) type =     Currency     FieldSpec name = accrualPeriodvalue = Ref (accruals.last)     type = Event

The intermediate representation of the spec as a whole is wrapped into aNamedSpec which states its name. A NamedSpec is a subclass of aNestedSpec and thus contains an inner spec. In the case of this examplethat inner spec is a SequenceSpec which groups a number of VarSpecs,followed by a DatePeriodsSpec.

Each VarSpec defines a name and an associated type and describes aparameter that is required in order to process the spec successfully.

The following DatePeriodsSpec expresses a repetition of periods andfirst defines the name of the iterator. It is also a NestedSpec, andsince it contains more than one spec in the body, the FieldSpecs andsubsequent EventSpecs are wrapped in a SequenceSpec.

Each FieldSpec describes a particular part of the state of theDatePeriodsSpec. Each is defined by the name of the state, its value atprocessing time, and its type. In the case of this DatePeriodsSpec, thevalue can not be described statically, but are determined at processingtime. Their value is determined by the processing context. For all threeFieldSpecs in this example the value is a NamedReference to a previouslydeclared state, in this case to “start”, “end”, and “paymentFrequency”,all of which were declared via VarSpecs earlier.

The ResetSpec is the first EventSpec inside the DatePeriodsSpec. It, asall the other EventSpecs, consists of a sequence identifier and a numberof FieldSpecs. The sequence identifier describes into which namedsequence Events generated by the particular EventSpec are added duringprocessing time. A canonical event extractor, which extracts theunmodified and full event structure from an intermediate representationand parameters will thus, for this example, collect ResetEvents into asequence called “resets”, AccrualEvents into a sequence called“accruals” and InterestPaymentEvents into a sequence called “payments”.

The references to assign a value into a FieldSpec use three new conceptsin those EventSpecs. The first FieldSpec in the ResetSpec refers to asub-state of the iterator, previously declared for the DatePeriodsSpec,it refers to the start of the period in each iteration.

The “rate” FieldSpec in the AccrualSpec refers to the last collectedResetEvent in that iteration. Similarly, the accrualPeriod in theInterestPaymentSpec refers to the last collected AccrualEvent. Thus, acanonical event extractor will, in each period, extract three Events, areset event, an accrual event which points to the reset event, and aninterest payment event which points to the accrual event.

The last interesting way to assign a value is via a ScriptReference. The“payDate” FieldSpec within the InterestPaymentSpec describes a valuewhich is a ScriptReference containing: “period.end+days”. This, ineffect, is just a pretty print version of a more complex object treecontaining a NamedReference and a LiteralReference, spelled out itreads: Script(“addDays”, Ref(period.end), LiteralReference(2)). Thisscript is evaluated during processing and will result in the appropriatevalue (for all processors which actually create a value for this fieldin this event).

Two concepts are not illustrated by this example, the nesting ofNamedSpecs and the overwriting of declared variables. A NamedSpec startsa new scope for declared variables. Only the variables declared withinthat scope are visible within the scope, variables declared outside thescope are not visible. Variables declared within a nested NamedSpec areaccessible from the outside using a dot notation. This enables aredefinition, e.g. either a renaming, or a value assignment to thevariables declared below. Such a redefinition can also happen in thesame scope, e.g. a prior declaration always replaces a subsequentdeclaration. This is interesting when the body of a NamedSpec isincluded into another spec, e.g. see Listing 6.

Listing 6: Restricted Swap Leg Intermediate Representation NamedSpecname = “USD3MonthLIBORLeg”  SequenceSpec   ConstSpec name = currencyvalue = USD type = Currency   ConstSpec name = rateIndex value =USD-LIBOR type = SmileIndex   ConstSpec name = discountOn value =USD-LIBOR type =   DiscountIndex   Spec ref =SwapLegFinancialSpecification

Here, the currency, rateIndex, and discount rate are fixed. When thisintermediate representation is processed, parameterization of thosevariables is not required and when present their values are ignored.

Another spec can also be included and renamed in the process, this givesall variables a prefix, as if nested in a NamedSpec. This is shown inthe example in Listing 7.

Listing 7: Renaming in a Swap NamedSpec name = “TwoLeggedSwap”  VarSpecname = notional type = Float  TempSpec name = first.notional ref =notional  TempSpec name = second.notional script = “−notional”  Spec ref= SwapLegFinancialSpecification as = “first”  Spec ref =SwapLegFinanciaiSpecification as = “second”

Explicitly only one variable, for “notional”, is declared in this spec.Implicitly the variables declared in the two included specs are alsodeclared here, albeit with a prefix. Two TempSpecs are used to overwritethe “variableness” of the notional for both included specs, using thedot-notation, the one declares first.notional, the othersecond.notional. The temp declarations as used here, basically hook thenotionals of the included specs together with the notional declared inthe TwoLeggedSwap.

2.6.3. Processing the Intermediate Representation

The intermediate representation can be processed in various ways.Analogous to the ideas about valuing financial instruments and thebenefits of separating the description of a financial instrument fromits processing, the processing of the intermediate representation isseparated from the intermediate representation. There is no knowledge inthe intermediate representation on how the processing is done, except ageneric mechanism that enables the processor to know which object of theintermediate representation is to be processed: the double dispatchingmethods.

Examples for different spec processors are: SpecPrinter (printsformatted intermediate representation), VariableExtractor (determineswhich variables need to be specified as spec parameters when processinga spec), EventExtractor (generates the canonical event structure fromspec and parameters). Other kind of processing can include: generationof confirms, specialized event extraction for particular pricers.

In the following sections we first describe how the EventExtractor isstructured and then how it processes the intermediate representation andgenerates the canonical event structure.

2.6.4. Event Extraction Objects

The central classes used in the processing and event extraction processare presented in Listing 8 (indenting denotes sub-classing).

Listing 8: Event processing class structure SpecWalker an interface thatdescribes the double dispatch operations all   spec walkers must be ableto perform, as well as operations for   resolving references. SpecPrinter a class that can format and print the spec tree and its components.  ResolvingWalker an abstract class that can resolvereferences.   VariableExtractor a class that computes the required specparameters.   EventExtractor a class that extracts the canonical eventstructure. Bindings an interface to set and access name-valueassociations  Bindings.UnorderedString an implementation that usesstrings and    unordered associations. WalkingContext an interface whichdescribes access to the stack of    bindings required for processing,and reference lookup    and setting.  ResolvingContext context used forresolving walker

These classes form certain patterns together with the intermediaterepresentation and for some SpecWalkers together with the parameters.

A SpecPrinter provides the simplest example. It takes only theintermediate representation as input. It then makes use of a processcalled double dispatching to traverse the intermediate representation.Double dispatching is a mechanism that enables us to define all theprocessing in the SpecWalker, yet have all the knowledge about theparticular spec-structure contained in the intermediate representation.This means that one SpecWalker can process all kinds of specs build fromthe basic intermediate representation building blocks (later in thisspecification this same mechanism is applied to the processing of thefinancial events as well).

The protocol defined in Spec, the interface all intermediaterepresentation objects must adhere to, requires that each Specunderstands the message traverseIn(SpecWalker w), see Listing 9. EachSpecWalker requires that each implementation of a SpecWalker understandstraversal messages for all intermediate representation objects, asdisplayed in Listing 9.

Listing 9: Spec, Reference and SpecWalker interface public interfaceSpec{  public void traverseIn(SpecWalker s); } public interfaceReference{  public Object getLiteralIn(Specwalker w) throwsReferenceNotDefined; } public interface Specwalker{  voidtraverse(NamedSpec s);  void traverse(sequencespec s);  voidtraverse(DatePeriodsSpec s);  void traverse(EventSpec s);  voidtraverse(VarSpec s);  void traverse(TempSpec s);  voidtraverse(FieldState s);  void traverse(DataSpec s);  Object getLiteral(NamedReference ref) throws ReferenceNotDefined;  Object getLiteral(ScriptReference ref) throws ReferenceNotDefined;  Object getLiteral(LiteralReference ref) throws ReferenceNotDefined; }

In each particular implementation of a spec the call totraverseIn(SpecWalker w) is bounced back to the SpecWalker immediately,with w.traverse(this), or in the Smalltalk implementation with walkertraverseVarSpec: self. The compiler takes care about the appropriatemethod dispatch in Java; that information is encoded in the method namein the Smalltalk implementation.

The implementation for traverse(SomeSpec s) in a particular SpecWalkerthen processes that particular spec. E.g. a SpecPrinter would print thename of the spec, and prints the internal state. A SpecWalker knowsabout the internal structure of a Spec, e.g. for a NamedSpec, theSpecWalker is allowed to access the name, and it can access the nestedspec, it is not allowed to assume though which particular spec iscontained as the nested spec. Instead it double-dispatches to thatnested spec, using nestedSpec.traverseIn(this), or in SmalltalknestedSpec traverseIn: self. The nested spec then bounces back asdiscussed before, and the correct spec processing method in theSpecWalker will be called.

The traversal of specs does not return any value. Thus references havetheir own double dispatch protocol which enables the SpecWalker toretrieve the value of a reference within the context of the currentprocessing. A reference can be asked to getLiteralIn(aSpecWalker) andwill bounce back to the SpecWalker with aSpecWalker.getLiteral(this), orin Smalltalk aSpecWalker getLiteralNamedReference: self. Returned is anobject which represents the value of this reference at this point ofprocessing. How the reference is resolved and how events are collectedis discussed in the following section.

2.6.5. Event Extraction Process

Whereas the SpecPrinter only interacts with the intermediaterepresentation and does not require to keep any processing context, theEventExtract and the VariableExtractor both need to resolve reference inorder to compute their value. They both inherit the appropriate behaviorfrom a common superclass named ResolvingSpecWalker.

The ResolvingSpecWalker keeps an instance conforming to theWalkingContext interface (see Listing 10). This is an object whichmaintains a stack of Bindings and can be asked to push and pop a newBindings object, to store and retrieve the value for a given name, andto collect and retrieve events.

Listing 10: Bindings and WalkingContext interface public interfaceBindings{  public static Object UnknownValue = new Object( );  publicstatic Object InitialValue = new Object( );  public void put(Stringname, Object value);  public Object get(String name); } public interfaceWalkingContext{  public void push(String name, Bindings frame);  publicvoid push)Bindings frame);  public void pop( );  public BindingspeekBindings( );  public String peekNames( );  public void put(Stringname, Object value);  public Object get(String name) throwsReferenceNotDefined;  public String getScopeName( );  public EventsgetEvents (String name) throws ReferenceNotDefined;  public HashtablegetEvents( );  public void collectEvent(String name, Event event); }

Every time the resolving spec walker processes a structural intermediaterepresentation object it pushed a new Bindings object on the context. Ifa NamedSpec is processed the name of the spec is pushed as well. Thisstack of bindings and names forms the basis for the value lookupmechanism implemented in the concrete implementation for theWalkingContext. Currently one such implementation exists, theResolvingContext.

When an object is stored into the WalkingContext it is just stored intothe top Bindings object. When an object is retrieved via its name fromthe context and can not be found in the top binding, the subsequentbindings are searched. For each bindings frame which is named, the nameis used as a prefix to the current search name. This implements theoverwriting mechanism presented in Listing 7. Note, that the initialname will never be a compound name (using the dot-notation), since theaccess of names from outer scopes is not permitted.

Listing 11: Getting an object in the ResolvingContext public Object get(String n) throws ReferenceNotDefined{  Bindings frame;  Object result; String name = n;  String frameName;  for (int i = frames.size( )−1;i>=0; i−−) {   frame = (Bindings) frames.elementAt(i);   result =frame.get(name);   if (result != Bindings.UnknownValue) return result;  frameName = (String)names.elementAt(i);   if (frameName !=UnnamedFrame) {    name = frameName + “u” + name;   }  }  throw newReferenceNotDefined( ); }

When the ResolvingSpecWalker processes a VarSpec, the current value fora reference of that name is retrieved and stored into the context (seeListing 12). If the value can not be found an error situation hasoccurred, since the parameterization is required to contain all VarSpecswhich are not overwritten.

Listing 12: Traversing a VarSpec in the ResolvingSpecWalker  public voidtraverse (VarSpec v) {   object value = null;   Reference ref = newNamedReference(v.getName( ));   try {    value = ref.getLiteralIn(this);  } catch(ReferenceNotDefined e) {    System.out.printIn(“Error:variable” + v.getName( ) + “not    defined”);   }  context.put(v.getName( ), value); }

A TempSpec and DataSpec are handled in similar ways, for a TempSpec thereference is retrieved and stored in the context, for a DataSpec, theliteral object is simply stored into the context.

When retrieving a NamedReference the ResolvingContext first checks ifthat reference refers to an event, and if so the event is returned (if adot notation is used, the correct subpart of the event is returned). Fora LiteralReference the value is returned directly since it does not needto be evaluated in a context. A ScriptReference is evaluated byexecuting the script, using the perform mechanism in Smalltalk, and thereflection mechanism in Java.

The VariableExtractor makes use of this framework by overwriting theimplementation for the VarSpec. Its task is to find all requiredparameters for processing a spec in its intermediate representationform. Instead of raising an error when not finding the value for aNamedReference of the same name, the required variable is collected withthe proper prefixed name (if required), and an initialValue is assignedand registered in the current context.

Listing 13: Traversing a VarSpec in the VariableExtractor public voidtraverse(VarSpec v) {  Object value = null;  Type type = null;  String n= v.getName( );  Reference ref = new NamedReference(n);  try{   value =ref.getLiteralIn(this);  } catch(ReferenceNotDefined e) {   // registerin variables   String scope = context.getScopeName( );   value =Bindings.InitialValue;   type = v.getVarType( );   String k;   if(scope.equals (“”)) {    k = v.getName( );   } else {    k = scope +“u” + n;   }   variables.put(k, value, type);  }  context.put(n, value);}

In contrast the EventExtractor can assume that all required parametersare defined. Instead, its focus is the creation of the appropriateEvents and their collection into the proper event sequence. In contrastto the VariableExtractor it also needs to handle the iterator objectproperly.

The event generation for all events is handled in the same way. If it isrequired by a SpecWalker to treat EventSpecs for different kinds ofEvents differently, a sub-interface of the SpecWalker is used, whichdefines protocol for those kinds of EventSpecs explicitly. In thegeneric EventExtractor an Event is created for an EventSpec by firstaccessing a Map from EventSpec classes to Event classes. The found classfor the particular EventSpec is then asked to create an instance. Thisinstance is then filled with the proper state by iterating over theFieldSpecs. For each such spec the current value for the referencecontained in the FieldSpec is retrieved and that state is set into theEvent by using reflection (using another mapping from names used in theFieldSpecs to instance variables used in the particular event).

After the state of the event is filled it is stored into the contextunder the sequence name for that EventSpec. When collecting events theResolvingContext asks the Event for its preferred Event Collectionobject. Thus payment events can be collected into a payments collection,whereas reset events are collected into a resets collection. If nopreference is given a generic collection is used. Which kind ofcollection is used is significant for the second step of processing theevent structure and e.g. pricing it. The double dispatch mechanism therewill make use of the different collections events have been collectedin.

The iteration objects (e.g. DatesPeriodSpec) need to be rolled out whenextracting events. Analogous to event generation, first a newDatePeriods object is created and its state is filled with valuesdescribed in the collection of associated FieldSpecs. Based on thatobject an iterator object is initialized. A context for the iteration ispushed and for each iteration, the next value of the iterator isassigned into the name originally specified in the DatesPeriodSpec. Thenthe nested spec is traversed using the double dispatching protocolexplained above. At the end the context is popped.

Listing 14: Traversing a VarSpec in the VariableExtractor public voidtraverse(DatePeriodsSpec s) {  DatePeriods p = new DatePeriods( ); this.setState(s, p);  BluePeriodGenerator it = newBluePeriodGenerator(p.start, p.end, null,   null, p. interval, false); if (!it.hasMoreElements( )) return;  context.push(newBindings.UnorderedString( ));  for (;it.hasMoreElements( );) {  context.put(s.getIteratorName( ), it.nextElement( ));   s.getSpec().traverseIn(this);  }  context.pop( ); }

2.7. Benefits of the Financial Instrument Structure

There are several benefits of the financial instrument structuredescribed above that are very interesting from the system designperspective. These are described briefly below.

2.7.1. Persistence-Relational vs. Object Oriented Databases

New exotic financial instruments evolve quite rapidly and they aretypically characterized by very complex event structures. These eventstructures are typically quite diverse. One cannot expect them to beregular extensions of a common structure. An important aspect of anexotic financial system is its ability to incorporate these newinstruments and their event structures in a timely manner.

Modern object oriented databases allow complex object graphs to be madepersistent. One can design the object model and assume that the databasewill map the object into a form of persistent storage. The object modeleffectively “is” the data model so no explicit data model is required.This greatly simplifies the entire development process from the point ofview of the developer, especially when the object model becomes quitecomplex.

Relational databases, on the other hand, require not only an objectmodel but an explicit data model and an explicit mapping between thesetwo models. Both the models and the mapping strategy must be keptsynchronized at all times for proper persistence behavior to bemaintained. This requirement increases the amount of effort and overheadincurred by the business application developers when designing andimplementing functionality.

The above discussion points out the major theoretical reasons whycomplex financial products can be better served by an object orienteddatabase. There is typically more overhead when using a relationaldatabase as a persistence mechanism for object oriented systems thatdepend upon highly complex object models.

As stated in Section 2 (“Financial Instrument Internal Structure”),every instance of an instrument can be represented either statically oras an event structure. This flexibility can allow a developer to employa relational database with far more efficiency. It is now possible tomake persistent only the static representation of an instance of anygiven instrument. The event structure can, by definition, always beobtained by transforming the static representation, thereby removing theneed to make the event representation persistent.

This benefit is obtained, however, only if one makes the assumption thatthe parameters in the static representation of an instrument are farless complex than the actual events in the event representation. Thisassumption seemed reasonable initially and has proven itself to becorrect in all implementations to date.

One additional benefit is that one can now store instances of financialinstruments in more or less constant space with respect to maturity. Inmany other implementations where the event structure is stored, thespace necessary for persistence is linearly proportional to the maturityof the instrument.

2.7.2. Implementation Factoring Benefits

The factoring of the financial instrument structure allows a developerto independently choose the class (and therefore class hierarchy) forthe specification and the parameters. This allows the developer tocreate a new instrument that has a description (i.e., specification)that is much like an existing instrument, yet create a data bindingbased on a completely different instrument.

2.7.3. Specification Composition

The design also allows specifications to be “used” or “included” byother specifications. This composition strategy gives the developer amechanism for naturally modeling the fact that, in many cases, newinstruments are based not only on similar events but on similar eventspecifications.

The most relevant example of this is in the case of an option to enterinto an underlying contract. In most cases, the specification of such aninstrument is simply the specification of the underlying instrument plusmore information. This mechanism allows the developers to re-use theunderlying specification as a part of the new specification.

3. GENERIC PROCESSING FRAMEWORK

As stated numerous times above, one of the key design goals was toseparate the description of financial instruments from the processing ofthe instrument. Processing objects take the event representation of aninstrument, i.e. its macro structure, and operate on the events andparameters to compute some output value or values. This was done toallow development of new instruments to proceed orthogonally to thedevelopment of new processing functionality.

It is very important to note that in this design the valuationoperation, or pricing, is simply a specific type of processing. In termsof trading and risk management, pricing is the most critical operation.So it will typically be the most visible type of processing, but a typeof processing nonetheless. This means that the general framework forboth pricing and other kinds of processing objects will be exactly thesame.

The design of this part of the system implements a framework that allowsprocessing objects to walk over an instrument's financial eventrepresentation and implement an operation for each and every kind ofevent that they encounter. The concept is that the total processingalgorithm is implemented via proper operation on all of the financialevents. This is very much analogous to the concept described earlier;that financial instruments can be created by defining the structure andrelationships of base financial components. That is, if we can defineinstruments via composition of basic components then we should also beable to define processing algorithms composed of operations on thesebasic components.

3.1. Basic Object Oriented Processing Framework

The goal of this basic object oriented processing framework is to supplythe tools necessary to implement event based processing for any purpose,be it pricing, processing, querying etc. This framework, once completed,is then leveraged to implement frameworks for the different types offunctions. An example of a possible class hierarchy is depicted in FIG.10.

As seen in FIG. 10, the example hierarchy initially divides intosub-hierarchies that provide frameworks for product pricing 1001 andgeneric event processing 1002.

The pricing framework then divides into frameworks 1011, 1012, etc. tosupport different types of pricing. It is important to note that thetypes of pricing defined are based on pricing methodologies instead ofactual product types. This differentiation is necessary to provide theflexibility to define many different pricers for a given instrumenttype.

For example, it is true that one could price an interest rate swapinstrument using multiple methodologies; a cashflow present valueapproach, a probabilistic tree based approach and a Monte Carloapproach. This framework easily allows for multiple implementations ofpricer classes for this type of instrument and also provides thenecessary framework for each implementation.

The processing framework provides a generic way to walk over aninstrument's macro structure and extract useful information. Forexample, one could implement a processor that would in effect “query”every product macro structure for all option exercise related events.This processor would be applicable to every existing instrument as wellas all future instruments as long as the set of events with optionexercise characteristics were consistently defined and utilized. Thissignificantly reduces the amount of maintenance effort required tointroduce new instruments as well as increasing the control aspect ofcritical event processing.

The responsibility of the top level BasicProcessor class in this exampleis quite simple. In this class a valueEventType: anEvent method isdefined for each an every event type that exists (where EventType isreplaced with the name of the event class). The implementation of thismethod for each event effectively registers this event type with theprocessing system. This means that as developers add event types theonly initial requirement for processing is that a method be entered onthis class for that event type.

Also, a valueGenericEvent: anEvent method is defined. The event specificvaluation methods described above are implemented to immediately callthis generic method. Hence, initially, this framework provides that anyevent will, by default, be processed as a generic event. Theimplementation of the valueGenericEvent: anEvent is a subclassresponsibility.

If a developer wants to handle an event in a non-generic manner in anyprocessing sub-class he must simply override the initial implementationof the event's registered valuation method.

The BasicProcessor class also implements a valueEvents method. Thismethod, when invoked on an instance of a processor, should return the“value” of the instrument when invoked. The implementation of thismethod is deferred to the sub-classes of the BasicProcessor class andwhat the “value” is can vary widely.

Therefore, the top level framework provides the following features todevelopers:

-   -   A registration service that defines one valuation method name        for each event type    -   A mechanism by which all event types, unless otherwise        overridden in the subclass implementation, are treated as        generic events    -   A default event valuation method that is meant to be overridden        by each subclass so that default processing behavior can be        easily implemented by processor developers    -   An API, valueEvents, that is the main entry point for initiating        a valuation on an instance of a processor.

The combination of the way in which the valueEvents method and all eventspecific valueEventType:anEvent methods are implemented amounts to thedefinition of the processing action of any given processing sub-class.

3.2. Micro Structure Processing

As described earlier, for each specific type of financial event, aprocessor defines a method which computes a result (i.e. valueEventType:anEvent). The type of result, for the given financial event, is purelydependent on the type of processor in question.

For example, a processor that is used to obtain the “price” or MTM of afinancial instrument would calculate results for financial events thatwould be combined to produce this price for the instrument. A processorthat was responsible for querying the instrument to determine allpayment flow dates for the next N days would return quite differentresults for each financial event. It might even ignore some financialevents that were not relevant to this operation.

For each specific type of financial event, a processor can only rely onthe micro structure of that event. The action to be performed for eachtype of financial event is defined, in the processor, independently fromthe action for any other type of financial event. It cannot assume aspecific type for any nested financial event, only that the nestedevents adhere to the stated interfaces. These interfaces can be used toprovide processor independent information about the internally nestedevents.

This can be illustrated by the specification examples detailed earlierof the interest rate swap leg and the interest rate option instruments.The major difference between these two instruments is that the accrualevent points to a different type of rate event. In the former case itpoints to a basic rate event and in the latter case it points to a rateoption event. This is allowable because the micro structure of theaccrual event expects a “rate interface” in the rate instance variableof the accrual event and both types of rate event satisfy thisinterface.

All processor dependent results are obtained via a double dispatchmechanism which encapsulates the processor and separates it from theactual type of the nested financial events. This mechanism chooses thenext processing step inside the processor for a nested financial eventbased-on the actual event type.

3.3. Macro Structure Processing

The actual event type that is nested within any financial event iscompletely determined by the macro structure of the instrument beingprocessed. As described earlier, the macro structure of an instrumentdefines the actual events and their relationships to each other. It isthis macro structure which determines the overall processing of theinstrument. Thus, a processor does not require, and is not permitted tohave, any a priori knowledge of the structure of a given financialinstrument.

This is a very important concept as it allows a processor to process anywell formed macro structure because the macro structure itself drivesthe sequence of processing steps.

This is best illustrated by an example. Suppose a processor inquires ofa given macro structure for its payment events. Only the macro structurehas the knowledge of what kind of payment event types are actuallycontained in this set. Upon receipt of these events the processor visitseach event and uses the double dispatch mechanism to choose the rightmethod for processing the actual event type.

When a method is chosen to process a given payment event, that event isthen processed as described in Section 3.2 (“Micro StructureProcessing”). While in this processing mode the double dispatchmechanism is used again whenever a processor dependent result isrequired for an event nested within the payment event. This again causesthe proper method to be selected based on the actual event type inquestion and this event type is defined by the macro structure.

Therefore, the actual methods and the order in which they are visited onthe processor object is completely determined by the macro structure. Inthis way we say that the macro structure drives the processing of afinancial instrument.

In summary, a processor just defines what to do for each specific eventtype and the macro structure determines which methods are visited and inwhat order.

3.4. Basic Description of Double Dispatch

As described earlier, a double dispatch mechanism is employed todetermine which processing method is chosen for a given financial eventwithin a given processor. The example below will illustrate how a doubledispatch design pattern is used to implement this behavior.

FIG. 11 depicts the methods that need to be implemented on the eventclasses and on the processing class to effect a double dispatchparadigm. The method implemented on the event classes,valueEventInProcessor: aProcessor, is meant to be polymorphic across allevent classes. These methods essentially define a mapping between theclass type and the type of processing that it expects to receive withina processor. It is crucial to understand that these methods do notspecify anything about what the processing actually accomplishes, theysimply specify which category of processing should be applied to theinstance by the processor.

The methods implemented on the processor class are meant to explicitlydefine the processing algorithm for each type of financial event. It isimportant to realize that these methods make absolutely no assumptionsas to where the event sits in a given macro structure, they simplyprocess an event of the given type based on the event's micro structure.Note that this does not mean that external information, such as marketdata, cannot be used as a context when processing an event. It is therelationships of the events (i.e. the macro structure) that cannot beassumed by the processor, all other contextual information is allowablein this strategy.

In FIG. 12, one can see an example of how an instance of an interestpayment event is processed in a given processor. Assume that we are in aprocessor method for a given event type. This method requires aprocessor dependent valuation of a nested event. At this point, thenested event type is not known beyond the interface declared in themicro structure for the enclosing event.

The processor sends the message valueEventInProcessor: self to thenested event. As described earlier, all events must support thisinterface for proper processing. The event responds by sending theappropriate message back to the processor based on how this method isimplemented for its class. In this case, an instance of anInterestPaymentEvent will send the message valueInterestPaymentEvent:self back to the processor instance. At this point, the processor knowsthe actual type of the nested event and can proceed with processingaccording to the micro structure of that event. Thus, the previouslynested event now becomes the event being processed. Once again, theprocessor has no knowledge of and should make no assumptions on how theevent is embedded in the macro structure of the instrument.

This process occurs recursively within any event if there is a need forprocessor dependent valuations of its nested events.

3.4.1. Nested Double Dispatch

Nested double dispatch is a mechanism that allows the developer toprocess any event contained in its micro structure via the doubledispatch mechanism. This nested process allows this to occur any numberof times. FIG. 13 represents a nested double dispatch.

The nested double dispatch simply allows the double dispatch mechanismto be used at any point in the valuation of any other event. The valueof the nested dispatch is returned to the calling method and used withinthe context of the valuation of that event.

3.4.2. Detailed Description of the Pricing Framework

Because valuation/pricing is such an important aspect of the modelingand implementation of financial instruments this section will give moredetail on this topic.

3.4.2.1. The Cashflow Valuation Methodology Implementation

The implementation of the cashflow valuation methodology is a goodexample because the BasicCashflowPricer class implements a frameworkwhich, when applied to a given instrument's macro structure, defines howthe macro structure is processed.

Essentially, this class implements a framework that causes all cashflowevents to be processed at the top level. A present value is calculatedfor each cashflow event found in an instrument's macro structure. Thevalue of the instrument is defined to be the sum of all these presentvalues. The code in Listing 15 illustrates this framework:

Listing 15: Basic Cashflow Pricing Implemented Behaviour Cashflow PricerClass Instance side: valueEvents sumCashflows = 0 self.instrument.eventsdo:[:anEvent | sumCashflows = self.-   presentValue(self.valueEvent(anEvent)) ] return sumCashflows -------------------------------------valuePaymentEvent(thePayment) return thePayment.notional------------------------------------- valueGenericEvent(theEvent) return0.0 -------------------------------------

The valueEvents method is overridden from the super class to walk overall events that exist in the instrument, obtain the present value foreach value and sum the resulting values. The value of each event isdetermined by its type by the double dispatch mechanism. Therefore, ifan event is a cashflow event the valueCashflowEvent: anEvent code isexecuted and returns the notional value of the cashflow. If the event isof any other type, the framework described earlier forces these eventsto be valued as generic events. In this case, the cashflow pricer hasdefined the generic event method to return zero. Hence, only the valuesof cashflow events will be included in the final summation.

In this manner we have created a processing function by simply summingup the valuation methods implemented for given events. This frameworkcan then be easily extended by subclasses by simply overriding thevalueCashflowEvent: anEvent to perform other, more complex operations.

3.4.2.2 Extending the Basic Processing Framework

The basic cashflow pricing framework can be easily extended in asub-class to handle a more complex cashflow event, a swap payment eventthat was described earlier in FIG. 8. A set of events that representsone of these payments is depicted in FIG. 14.

The additional/overridden methods for the sub-class of theBasicCashflowPricer are shown in Listing 16:

Listing 16: Fixed Swap Payment Pricer Methods Fixed Swap Payment PricerInstance side: -------------------------------------valuePaymentEvent(thePayment)  return  thePayment.notional*self.valueEvent(thePayment.-  accrual)*thePayment.accrual.rate -------------------------------------valueAccrualEvent(theAccrual)  return(self.endDate-self.startDate)/self.dayCount-------------------------------------

One can see here that by changing one method and adding one more methodthis new sub-class can value a more complex payment event within theframework already implemented. Essentially, this subclass has definedthat the payment event's value will not be the product of the notional,the rate and the accrual period. The value of the accrual period isachieved via nested double dispatch as it is valued from within thevaluePaymentEvent method. This causes the valueAccrualEvent method to beinvoked and the value returned.

The framework already supports summing all the cashflow relevant eventsand taking their present value so this is all the new sub-class mustimplement to effect a significant change in the valuation method.

3.4.2.3. Supporting Multiple Valuation Methodologies

As mentioned several times, there are usually multiple ways in which tovalue any given instrument. These are divided up into methodologies asreflected by the sub-classes of the Basic Financial Pricing class asdepicted earlier. Typical methodologies include:

-   -   Cashflow present valuation methodologies—Each valuation relevant        event (e.g.—a cashflow) of a product is valued independently        using accepted analytics and the present value is taken.    -   Probabilistic tree valuation methodologies—A probabilistic tree        is built that is used to determine the valuation of the        instrument's events.    -   Monte Carlo valuation methodologies—A true simulation is built        and driven with some inputs to determine the valuation of the        instrument's event.

The above is by no means an exhaustive list of available valuationmethodologies. The important concept is that one must provide aframework that can support any number of methodologies as theyinvariably evolve over time.

If it were desired to be able to price a swap instrument in all theabove methodologies one would expect to find one class in each hierarchythat would be capable of this functionality. Then, one could choose thevaluation methodology at run time by choosing which class of pricerinstance to apply to the instrument.

3.4.2.4. Support for Analytics Implemented in Other Technologies

The analytics for any one methodology can also be implemented indifferent types of technologies. One typically finds that, as thecomputational resources required for a given analytical implementationincrease, the level of implementation language decreases. This is simplybecause lower level languages tend to provide better performance on thesame hardware. Hence, one would expect to see computational expensiveimplementations of Monte Carlo simulations implemented built inprocedural languages such as C or Fortran. This is by no means alwaysthe case but is a good rule of thumb.

Therefore, the pricing framework must also provide for interfacing withanalytical implementations that may not be in the same technology. Thisis typically done by providing an interface between the two technologiesin which instrument data is passed into the analytics and pricing datais passed back to the main application. The cross-technology interfaceis simple to achieve. The issue left to resolve is, how does one convertbetween the object model of the instrument in the main system and therepresentation required by the analytical implementation?

The answer is that the pricing framework is essentially reduced to adata format conversion function. The framework for each type of externalinterface would walk over an instrument's events and, instead ofcalculating values itself, it would simply convert the applicable eventsto a data format specified by the external interface. Once a frameworkfor each interface is built it becomes much simpler when new analyticalimplementations are available for that interface type.

3.5. Benefits of Separation of Processing from Instrument Specification

The classic object oriented view is that the definition of an objectshould encompass its state and its behavior. This design, on the otherhand, specifically and explicitly separates what can be consideredbehavior from the description. The question raised is—Why is this deemednecessary?

3.5.1. Long Term Design Stability

Let us consider the classic case. Consider the instrument specificationdefined in Section 2.5 (“Simple Instrument Specification”), whichdescribes a simplified version of an interest rate swap leg and aninterest rate option instrument. In the classic object orientedparadigm, all processing methods would be implemented on these objects.For example, the swap object would know how to value itself, return aseries of known and unknown payments etc.

To implement a properly modular system around instruments developed inthis manner, developers typically define an appropriate interface. Thisinterface typically represents all of the necessary functionality thatany instrument must provide to the rest of the system to “fit in”. Thecreation of a new instrument class simply requires that the developerimplement the well-defined interface properly for the instrument inquestion. It is unimportant how the developer implements the interfacefor the instrument as the interface is meant to hide all the internalcomplexity of an instrument from other objects.

This strategy seems quite reasonable on first consideration. It is aproperly “object oriented” approach and simple to implement. Inpractice, this approach would work quite well during the initial phasesof a financial instrument model.

In reality, however, one must consider the viability of such a modelwell into the later stages of its existence. The simple interfaceapproach begins to fail as it becomes necessary to add more processingfunctionality to the system as time marches on. It is always necessarythat the new functionality be applicable to not only newly developedinstruments but to all existing instruments as well.

This means that all existing implementations of financial instrumentswould have to have the additional interface individually coded by adeveloper. As the total number of supported instruments grows, thisbecomes quite a difficult task. Each new interface can require aninordinate amount of effort, especially if the internal complexity ofeach existing instrument is not well understood by the developer taskedwith upgrading it.

The separation of processing from the instrument class and a welldefined processing mechanism mitigates this problem. If the model isadhered to, one can expect a new processing class to operate on allexisting financial instruments as well as any new instruments. Thismeans that if the interface needs to be extended one simply writes a newprocessor. This reduces the extension of the interface to a singledevelopment step as opposed to a series of steps that will get moredifficult as the system grows.

3.5.2. Pricing Framework Benefits

There is another reason, more specific to valuation models in thefinancial arena, for the separation of processing objects frominstrument description objects.

As stated earlier, one of the major uses of many financial systems isfor risk management and pricing purposes. This means that a veryimportant subset of processors are the “pricer” classes. These classesprocess financial instruments, in the context of a set of market data,and return a monetary value or “mark-to-market” (MTM) of the giveninstrument. This MTM is a function of the instrument itself, the marketdata and the valuation methodology.

In the financial pricing arena, there are typically several valuationmethodologies that can be used to return a MTM for a given type offinancial instrument. In many cases, there is not really a “correct”methodology. The methodology to be used is usually chosen based on atrade-off between accuracy and performance. Typically, the more accuratea pricing methodology the more resources are required.

This means that one instrument can be valued in several differentmethodologies and the decision as to which methodology is to be used canvary over time. The ability to easily choose a pricer object thatimplements the desired methodology is a very important and powerfuladvantage of this model. This is not easily done if all of theprocessing/pricing knowledge is implemented on the instrument itself.

An additional benefit is that pricing objects can share basic behaviorvia inheritance and that these objects can be used for multipleinstruments. Otherwise, if the processing behavior is implementeddirectly on the instruments there would be a large degree of codeduplication.

4. FUTURE WORK

The following sections briefly point to areas that we are currentlyinvestigating to broaden the use of our model.

4.1. Lifecycle Support of Financial Instruments

The current focus of the representation of instruments in our model istowards valuation and risk management in front-office and mid-office.Clearly, other kinds of processing and thus other kinds of attributesare imaginable and desired during the lifetime of a financialinstrument.

One interesting approach is to think of a financial instrument not ashaving only one associate specification and parameters, but to see it asa bag of specifications and parameters, changeable over the lifetime ofthe financial instrument and targeted towards the different demands ofthose domains.

One example for this approach is an audit trail. Up to the point where atrade is confirmed no audit trail information needs to be kept, theinstrument is in the front-office experimental stage. As soon as thetrade is confirmed an audit spec and audit parameters are added to theinstrument, stating which finance parameters can be changed at all, bywhom, and also how and where to record the audit trail. The audit trailmight actually be recorded right in the instrument itself, as aread-only state related to the audit specification, or it might berecorded in a relational database the audit spec refers to.

Another example is the information required for the back office. As soonas an instrument enters the back-office, a back office spec andassociated parameters are added and can describe things such as whenpayments were made and received, what kind of netting agreements affectthe current instrument etc.

4.2. Process Specific Event Extraction Transformations

The approach presented in this paper always uses one event extractionprocess, which produces the “canonical” event structure, as explainedabove. For certain kind of event processing, it would be beneficial touse a process-specific event extraction process. This would allowprocessing designers to fine-tune the time and space behavior of eventextraction and event processing.

Instead of asking the instrument directly to generate and return anevent structure, this request would always be delegated via theprocessing which is interested in processing the resulting events. Itcould then decide not to employ the “canonical” event extractionprocess, but to use a process specific event extraction process instead.The canonical event structure would still be returned in most cases andalso serves as an important concept, since a specification should alwaysbe written to generate a canonical event structure which resembles the“real-world” structure of the financial instrument most faithfully. Yet,one would also have the opportunity to optimize special processingcases.

For example, the processing of resets only requires the generation ofreset events. The processor could use a specialized event extractorwhich would ignore the other event streams and only instantiate resetevents.

Another example is the integration of external processing methods whichare not written using the processing methodology presented here. Suchprocessing methods might be using old existing systems, or they mightcome from other departments, e.g. the research department, which do notuse the same modeling and processing methodology. Often the interface tosuch systems are one or more function calls which require lists ofvarious dates and values which, in the approach presented here, arespread across various events in the canonical event structure of aninstrument.

In the current system this is done by generating all events in thecanonical event structure and then running a processor which extractsthe relevant data from the event structure.

A specialized event extractor for such processing might not evengenerate events at all, but instead directly collect the appropriatevalues into arrays which can then be used as arguments to the externalprocessing method.

Both cases show the advantage of having a specification which can beprocessed to generate appropriate events, over algorithmically generatedevents. In the latter case one would need to copy and then rewrite thecentral part of that algorithm to satisfy the different outrequirements. Furthermore, this could not be done in an instrumentindependent manner, as in the specification based approach, but wouldhave to be done for every instrument which would require suchprocessing.

4.3. Separating Default Values from Specifications

In its current form the default values for variables are contained inthe specification itself. This is not suitable for an internationalusage of instruments. A trader creating a new swap leg in Tokyo expectsto see a different initial setting of the state than a trader creating anew swap leg in New York.

One solution would be to create a new kind of specification for defaultvalues. The core of a financial specification would stay the same, butthe default specifications would be set based on the user location.

The additional benefit of such an approach would be that the knowledgeof interrelated default values could be embedded in such adefault-specification. For example, the knowledge to adjust basis andtenor according to a changed currency could be embedded in the defaultspecification instead of in the user interface of the instrument.

5. CONCLUSION

Our experience shows that the model described here offers significantbenefits to the developers of financial systems that must use objectoriented technologies to represent financial instruments. As currentlyimplemented, it is biased towards systems where pricing and large scalelife cycle processing are the main deliverables. But, we believe that itis flexible and generic enough to be used successfully in various othercapacities.

One of the main goals of this project was to design a model that couldbe maintained and extended for many years to come. Much thought andeffort went into the design to try and accommodate the unknown futurerequirements of the financial industry. While we recognize that we couldnot have covered all possibilities, we believe that we havesignificantly hedged our future needs.

The model described here has been implemented, to varying degrees, inboth Smalltalk and Java. Both implementations are in production in theJP Morgan Fixed Income systems group. We believe that this model hassignificantly improved the ability of the systems teams to manage andexploit the explosive growth in the Fixed Income business.

By the end of 1998, this model will be used to represent, process andstore all financial trades, both simple and exotic, for the global JPMorgan Fixed Income business.

It is apparent from the foregoing that a new system has been developedthat accomplishes the stated objects of the invention. While thepresently existing embodiment and certain variations thereon have beendescribed in detail, it will be apparent to those skilled in the artthat the principles of the invention are readily adaptable to otheradaptations and configurations of the systems described herein withoutdeparting from the scope and spirit of the invention, as defined in thefollowing claims.

We claim:
 1. A computer system for processing financial instruments, thesystem comprising: at least one storage device storing a plurality offinancial event templates, each financial event template comprising atleast one financial event component and defining, for each variablewithin said at least one financial event component that points toanother financial event component, a processor independent interface tosaid other financial event component and further providing a processinginterface as part of each said financial event component; at least oneprocessing object comprising procedures adapted to access arepresentation of said financial instrument through said processorinterfaces and specified independently from a static representation ofthe financial instrument; and at least one computer processor programmedfor accessing the storage device and constructing a representation ofsaid instruments including at least the static representation, theprogrammed computer processor executing instructions for performingsteps including, providing a set of parameters for said instrument, saidparameters comprising state information for said instrument;constructing an instrument specification for said instrument byselecting financial event components from said plurality of financialevent templates and incorporating said financial event components intosaid static representation; and executing said procedures of said atleast one processing object upon said financial event components throughsaid processing interfaces.
 2. The system of claim 1, wherein saidprocessing object is an event extraction object and the computerprocessing components are further programmed for generating an eventrepresentation of said financial instrument as an additional part ofsaid instrument specification, by reading the financial event componentscomprising said static representation, as instantiated by saidparameters, and generating a set of financial events therefrom.
 3. Thesystem of claim 2, wherein the computer processing components areprogrammed to further perform steps including: providing at least oneevent processing object recorded in the at least one storage device,said event processing object comprising procedures defining theprocessing to be performed for a plurality of event types, and specifiedindependently from the static representation of each said financialinstrument; and for at least one such financial instrument, reading saidevent representation of said financial instrument, and performing saidprocessing by executing on said at least one computer, upon the eventsof said event representation, those of said procedures defined in saidat least one event processing object that correspond to the financialevents of said event representation.
 4. A computer system for processingfinancial instruments, each said financial instrument being representedby an instrument representation comprising a static representation andan event representation of said instrument, said static representationcomprising a set of parameters comprising state information for saidinstrument and a set of financial event components selected from aplurality of financial event templates and defining, for each variablewithin said at least one financial event component that points toanother financial event component, a processor-independent interface tosaid other financial event component, and further providing a processinginterface as part of each said financial event component, and said eventrepresentation comprising a sequence of financial events associated withsaid instrument, said system comprising: at least one storage devicestoring at least one event processing object, said event processingobject comprising procedures defining the processing to be performed fora plurality of event types, and specified independently from the staticrepresentation of each said financial instrument; and programmedcomputer processing components accessing the at least one storage deviceexecuting instructions for reading said event representation of saidfinancial instrument for at least one such financial instrument, andperforming said processing by executing on said at least one computer,upon the events of said event representation, those of said proceduresdefined in said at least one event processing object that correspond tothe financial events of said event representation.
 5. The system ofclaim 2, wherein the computer processing components further executeinstructions for extracting only those financial events associated withsaid financial instrument that are required for a specified processor.6. The system of claim 5, wherein said processor processes reset events,and said event extraction object only extracts reset events.
 7. Thesystem of claim 5, wherein said processing is performed by executing amethod maintained externally to said event extraction object, and saidmachine-readable data generated by said event extraction objectcomprises machine-readable values usable as arguments to invoke saidexternal processing method.
 8. The system of claim 3, wherein said atleast one event processing object is a valuation processor.
 9. Thesystem of claim 8, wherein said valuation processor performs a cash flowanalysis, further comprising independently valuing each event relevantto valuation and determining the present value of such valuation bycalculating the present value.
 10. The system of claim 8, wherein saidvaluation processor performs a Black-Scholes analysis.
 11. The system ofclaim 8, wherein said valuation processor performs a Monte Carloanalysis, further comprising performing a simulation driven by financialinputs and using said simulation to determine a valuation of theinstrument's event.
 12. The system of claim 8, wherein said valuationprocessor performs a probabilistic tree analysis, further comprisingconstructing a probabilistic tree in machine-readable memory and usingsaid tree to determine the valuation of the instrument's events.
 13. Thesystem of claim 3, wherein said at least one event processing objectperforms the function of printing a formatted version of said eventrepresentation.
 14. The system of claim 1, wherein said at least oneprocessing object performs the function of determining the variablesthat must be specified as specification parameters when processing aspecification.
 15. The system of claim 2, wherein said at least oneprocessing object performs the function of generating the canonicalevent structure of said instrument from said static representation. 16.The system of claim 3, wherein said at least one event processing objectperforms the function of generating trade confirmations.
 17. The systemof claim 2, wherein said at least one processing object performs thefunction of extracting events in a specialized manner for specifiedvaluation processing objects.
 18. The system of claim 1, wherein said atleast one processing object is a modified version of second processingobject, and wherein either said processing object or said secondprocessing object is applied to said instrument representation withoutmodifying said instrument specification.
 19. The system of claim 3,wherein said at least one event processing object is a modified versionof a second event processing object, wherein said at least one eventprocessing object is a modified version of said second event processingobject, and wherein either said event processing object or said secondevent processing object may be is applied to the event representation ofsaid instrument representation without modifying the staticrepresentation of said instrument.
 20. The system of claim 3, whereinsaid event processing object performs the function of traversing theevents of said event representation and converting each event of saidevent representation to a data format specified by the data entryinterface of a processor for said events that is not adapted to saidprocessor interface.
 21. The system of claim 1, wherein said staticrepresentation is modified from a prior static representation over thelifetime of said financial instrument, and wherein said modified staticrepresentation is processed by the same processing objects as saidoriginal static representation without modifying said processingobjects.
 22. The system of claim 3, wherein, wherein said staticrepresentation is modified from a prior static representation over thelifetime of said financial instrument, and wherein said eventrepresentation is processed by the same event processing objects asapplied to the event representation generated from said original staticrepresentation without modifying said event processing objects.
 23. Thesystem of claim 21, wherein the computer processing components arefurther programmed for adding an audit specification and auditparameters to said financial instrument when a trade of said instrumentis confirmed, said audit specification and parameters stating whichfinancial parameters can be changed, identifying the persons withpermission to change said parameters, and specifying where to recordaudit trail information.
 24. The system of claim 23, wherein the audittrail information is recorded in said financial instrument as read-onlydata.
 25. The system of claim 23, wherein the audit trail information isrecorded in a relational database referred to by said auditspecification.
 26. The system of claim 21, wherein the computerprocessing components are further programmed for adding a back-officespecification and associated parameters to said financial instrumentwhen a trade of said instrument is confirmed, said back-officespecification and related parameters stating information comprisingconditions that affect said financial instrument and establishingmachine-readable storage for information comprising which dates andamounts of payments made and received.
 27. The system of claim 26,wherein said back-office specification and related parameters arerecorded in said financial instrument as read-only data.
 28. The systemof claim 26, wherein said back-office specification and relatedparameters are recorded in a relational database referred to by saidback-office specification.
 29. The system of claim 1, wherein thecomputer processing components are further programmed for providingdefault values for variables contained in said static representationwithin said static representation.
 30. The system of claim 29, whereinthe computer processing components are programmed for conditionallyselecting default values for variables contained in said staticrepresentation from one or more sets of default values.
 31. The systemof claim 30, wherein said sets of default values are international, andsaid selection is based on user location.
 32. The system of claim 1,wherein said at least one processing object acts upon said financialevent components via a double dispatch mechanism that selects theappropriate action for each financial event component withoutpredetermined knowledge of the overall referential structure of saidfinancial event components.
 33. The system of claim 3, wherein said atleast one event processing object acts upon said event representationvia a double dispatch mechanism that selects the appropriate action foreach financial event without predetermined knowledge of the overallreferential structure of said event representation.
 34. The system ofclaim 32, wherein a nested double dispatch mechanism initiated insidethe action for a given financial event component can select theappropriate action for any financial event component referred to locallywithin the financial event component.
 35. The system of claim 34,wherein said nested double dispatch mechanism can be applied recursivelyto any level.
 36. The system of claim 34, wherein a nested doubledispatch mechanism initiated inside the action for a given financialevent can select the appropriate action for any financial event referredto locally within the financial event.
 37. The system of claim 36,wherein said nested double dispatch mechanism can be applied recursivelyto any level.
 38. The system of claim 1, wherein said computerprocessing components are further programmed for storing said staticrepresentation persistently in a relational database.
 39. The system ofclaim 38, wherein the computer processing components are furtherprogrammed for reading said static representation from said relationaldatabase, and processing said static representation with said processingobject to create a representation of said financial instrumentcomprising both a static and an event representation thereof.
 40. Thesystem of claim 38, further comprising an object oriented database forstoring a representation of said financial instrument comprising bothsaid static and said event representation.
 41. The system of claim 38,further comprising a first hierarchy of instrument parameter objectsthat can be made persistent in a relational database and a secondhierarchy of instrument parameter objects that can be made persistent inan object oriented database; and a subclass in each said hierarchy forsaid instrument, each said subclass supporting the same interface andthe same number and names of variables.
 42. The system of claim 1,further comprising a specification for a static representation ofanother financial instrument incorporated as an element in said staticrepresentation.
 43. The system of claim 42, wherein said financialinstrument is an option to enter into an underlying contract, and saidother financial instrument is said underlying contract.